package com.farm.shop.dao;


import com.farm.shop.domain.FarmShopDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * 农家店铺表
 *
 * @author chglee
 * @email 1992lcg@163.com
 * @date 2019-09-06 19:44:50
 */
@Mapper
public interface FarmShopDao {

    FarmShopDO get(Long id);

    List<FarmShopDO> list(Map<String, Object> map);

    int count(Map<String, Object> map);

    int save(FarmShopDO farmShop);

    int update(FarmShopDO farmShop);

    int remove(Long id);

    int batchRemove(Long[] ids);

    /**
     * 审核通过
     *
     * @return 影响的行数
     */
    @Transactional(rollbackFor = Exception.class)
    @Update(value = "UPDATE farm_shop SET `status` = 1  WHERE id = #{id}")
    int updateStatusById(@Param("id") Long id);

    /**
     * 首页搜索
     *
     * @param keyword 参数
     * @return
     */
    List<FarmShopDO> search(@Param("farmName") String keyword);
}
